/**
 * 
 */
package ee.fujitsu.common;


/**
 * The Enum Type.
 *
 * @author Andrei
 * 
 * 07.09.2012
 */
public enum Type {
	
	/** The new release. */
	NEW_RELEASE("new", 0, "New release"),
	
	/** The regular film. */
	REGULAR_FILM("regular", 3, "Regular rental"),
	
	/** The old film. */
	OLD_FILM ("old", 5, "Old film");
	
	/** The type. */
	private final String type;
	
	/** The days. */
	private final int days;
	
	/** The title. */
	private final String title;
	
	/**
	 * Gets the title.
	 *
	 * @param type the type
	 * @return the title
	 */
	public static String getTitle(String type) {
		for (Type tp : Type.values()) {
			if (tp.getType().equals(type))
				return tp.title;
		}
		return null;
	}

	/**
	 * Instantiates a new type.
	 *
	 * @param type the type
	 * @param days the days
	 * @param title the title
	 */
	private Type( String type, int days, String title) {
		this.type = type;
		this.days = days;
		this.title = title;
	}

	/**
	 * Gets the days.
	 *
	 * @return the days
	 */
	public int getDays() {
		return days;
	}

	/**
	 * Gets the type.
	 *
	 * @return the price
	 */
	public String getType() {
		return type;
	}
}
